import logging
from time import sleep

import allure
from selenium.webdriver.common.by import By

from ding.LitemallPrac.page_objects.base_page import BasePage
from ding.LitemallPrac.page_objects3.product_delete import DeletePage


class HomePage(BasePage):
    _MENU_PPRODUCT_MANAGE=(By.XPATH,"//span[contains(text(),'商品管理')]")
    _MENU_PRODUCT_LAUNCH = (By.XPATH,"//span[contains(text(),'商品评论')]")

    #点击菜单
    with allure.step("点击菜单"):
        def got_go_comment_launch(self):
            # 点击“商品管理”菜单
            logging.info("点击“商品管理”菜单")
            self.do_click(*self._MENU_PPRODUCT_MANAGE)
            # 点击“商品评论”
            logging.info("点击“商品评论”")
            self.do_click(*self._MENU_PRODUCT_LAUNCH)
            sleep(3)

            return DeletePage(self.driver)


